//
//  CompereDetailsHeadView.m
//  RainbowFM
//
//  Created by Kratos on 14/12/11.
//  Copyright (c) 2014年 RB. All rights reserved.
//

#import "CompereDetailsHeadView.h"

#import "UIImageView+Circle.h"
#import "NSString+Size.h"

#import "CompereModel.h"

#define ContentLabel_MIN_H 38.f
#define SELF_MIN_H 335.f

@interface CompereDetailsHeadView()
@property (weak, nonatomic) IBOutlet UILabel *fansLable;//粉丝数量
@property (weak, nonatomic) IBOutlet UILabel *attentionLabel;//关注度
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;//姓名
@property (weak, nonatomic) IBOutlet UILabel *positionLabel;//职位
@property (nonatomic , weak) IBOutlet UILabel *contentLabel;//描述

@property (weak, nonatomic) IBOutlet UIButton *attentionButton;//关注按钮

@property (weak, nonatomic) IBOutlet UIImageView *headImageView;//头像
@property (weak, nonatomic) IBOutlet UIImageView *backgroundImageView;//背景图

@end


@implementation CompereDetailsHeadView

-(void)awakeFromNib
{
    [_headImageView showAsCircle];
    _headImageView.layer.borderColor = [UIColor whiteColor].CGColor;
    _headImageView.layer.borderWidth = 2.f;

//    [_attentionButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
}

-(void)updateCompereData:(CompereItem *)item
{
    if (item) {
        [_headImageView sd_setImageWithURL:[NSURL URLWithString:item.anchorHeadPic]];
        [_fansLable setText:_F(@"粉丝:%@",item.fansNum)];
        [_attentionLabel setText:_F(@"关注:%@",item.fansNum)];
        [_nameLabel setText:item.anchorName];
        _contentLabel.text = item.detail;
//        [self setText:item.detail];
    }else{
        [_headImageView sd_setImageWithURL:nil];
        [_fansLable setText:@"粉丝:0"];
        [_attentionLabel setText:@"关注:0"];
        [_nameLabel setText:@""];
        [self setText:@""];
    }
}

-(void)setText:(NSString *)text{

    
    [_contentLabel setText:text];
    
}

//-(void)buttonAction:(id)sender
//{
//    if ([_delegate performSelector:@selector(attentionButtonAction:)]) {
//        [_delegate attentionButtonAction:sender];
//    }
//}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
